package com.itheima.train.manager.order.controller;

import com.itheima.train.manager.domain.OrderHandler;
import com.itheima.train.manager.domain.OrderParams;
import com.itheima.train.manager.domain.ResponseResult;
import com.itheima.train.manager.order.service.ZhzOrderServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @program: itheima-train-manager-parent
 * @description: 查询排队接口
 * @author: zhanghz001
 * @create: 2021-07-06 17:08
 **/
@RequestMapping("/order")
@CrossOrigin("http://www.trainmanager.com")
// @RestController
public class ZhzOrderController {
    @Autowired
    private ZhzOrderServiceImpl orderService;
    
    @RequestMapping(value = "/queryQueue")
    public ResponseResult<String> queryQueue(@RequestBody OrderParams orderParams) {
        return orderService.querySortedInfo(orderParams);
    }
    
    @RequestMapping(value = "/queryById/{orderId}")
    public OrderHandler queryById(@PathVariable(value = "orderId") Long orderId) {
        return orderService.queryById(orderId);
    }
}
